package com.sanjin.form;

import com.sanjin.form.interfaces.Create;
import com.sanjin.form.interfaces.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.math.BigDecimal;

/**
 * @description:
 * @author: sanjin
 * @date: 2019/5/5 23:47
 */
@Data
@ApiModel
public class ParkSpaceForm{

    @ApiModelProperty(value = "id")
    @Null(groups = Create.class, message = "id must be null when create")
    @NotNull(groups = Update.class, message = "id must not be null when update")
    private Integer id;

    @ApiModelProperty(value = "车位名称")
    @NotEmpty(message = "name must not be null")
    private String name;

    @ApiModelProperty(value = "所属停车场id")
    @NotNull(message = "parkLotId must not be null")
    private Integer parkLotId;

    @ApiModelProperty(value = "价格(元/小时)")
    @NotNull(message = "parkLotId must not be null")
    private BigDecimal price;

    @ApiModelProperty(value = "状态 默认0 合法")
    @Null(groups = Create.class, message = "status must be null when create")
    @NotNull(groups = Update.class, message = "status must not be null when update")
    @Range(groups = Update.class, min = 0, max = 2, message = "status value in range[0,2]")
    private Integer status;
}
